
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <BMenu>
#include <BMenuBar>
#include <BListWidget>
#include <BMainWindow>
#include <BVBoxLayout>
#include <BSurface>

#include "TerrainCreater.h"
#include "ConvertDialog.h"
#include "CarverDialog.h"
#include "PainterDialog.h"

class MainWindow : public BMainWindow
{
public:
	MainWindow();
	~MainWindow();

	void loadTerrain(const BString& fileName);

protected:
	void slotTargetChanged(BObject* object, const BValue& value);
	void slotMenuTriggered(BObject* object, const BValue& value);
	void slotConvertButtonClicked();
	void slotCarverButtonClicked();
	void slotPaintButtonClicked();
	void slotLightingChecked(BObject* object, const BValue& value);
	void slotPolygonLineChecked(BObject* object, const BValue& value);
	void slotListClicked(BObject* object, const BValue& value);
	void slotApplyHandler(BObject* object, const BValue& value);
	void slotHandlerDetached(BObject* object, const BValue& value);
	void slotTerrainCreateFinished(BObject* object, const BValue& value);

private:
	BMenuBar*				_menuBar;
	BMenu*					_fileMenu;
	BButton*				_convertButton;
	BButton*				_carverButton;
	BButton*				_paintButton;
	BButton*				_textureButton;
	BCheckBox*				_lightingCheckBox;
	BCheckBox*				_polygonLineCheckBox;
	BListWidget*			_objectListWidget;
	BViewer*				_viewer;
	BHolder<BRoundHandler>	_mainHandler;
	BVBoxLayout*			_targetLayout;

	BHolder<TerrainCreater>		_terrainCreater;
	BHolder<ConvertDialog>		_convertDialog;
	BHolder<CarverDialog>		_carverDialog;
	BHolder<PainterDialog>		_painterDialog;
};

#endif
